{% extends "main/base.html" %}
{% load i18n static %}
{% block title %}{% trans '设备入库更新' %}{% endblock %}
{% block this_css %}
<link rel="stylesheet" type="text/css" href="{% static 'flatlab/css/bootstrap-select.min.css' %}">
{% endblock %}
{% block content %}
<div class="col-lg-offset-2 col-lg-8">
    <section class="panel">
        <header class="panel-heading">
            {% trans "设备入库更新" %}
            {% if form.errors %}
            <p>{% trans "提交的数据有误,请认真检查!" %}</p>
            {% endif %}
        </header>
        <div class="panel-body">
            <form method="post" class="form-horizontal">{% csrf_token %}
                {{ form.non_field_errors }}
                {% if request.user.is_authenticated %}
                <input type="hidden" name="created_by" id="id_created_by" value="{{ request.user.id }}">
                {% endif %}
                <div class="form-group">
                    <div class="col-sm-2">{{ form.warehouse.label_tag }}</div>
                    <div class="col-sm-10">{{ form.warehouse }}{{ form.warehouse.errors }}</div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2">{{ form.amount.label_tag }}</div>
                    <div class="col-sm-3">{{ form.amount }}{{ form.amount.errors }}</div>
                    <div class="col-sm-3">{{ form.cost }}{{ form.cost.errors }}</div>
                    <div class="col-sm-2">{{ form.can_sale.label_tag }}</div>
                    <div class="col-sm-2">
                        <div class="switch switch-square"
                            data-on-label="<i class=' fa fa-check'></i>"
                            data-off-label="<i class='fa fa-times'></i>">
                            {{ form.can_sale }}
                        </div>
                        {{ form.can_sale.errors }}
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2">{{ form.notes.label_tag }}</div>
                    <div class="col-sm-10">{{ form.notes }}{{ form.notes.errors }}</div>
                </div>
                <div class="form-group" align="right">
                    <div class="col-sm-12">
                        <button type="submit" class="btn btn-primary">{% trans "提交" %}</button>
                    </div>
                </div>
            </form>
        </div>
    </section>
</div>
{% endblock %}
{% block this_js %}
<script type="text/javascript" src="{% static 'flatlab/js/bootstrap-switch.js' %}"></script>
<script type="text/javascript" src="{% static 'flatlab/js/bootstrap-select.min.js' %}"></script>
{% endblock %}